home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
82.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-17
|
503b
|
23 lines
/*
There may be additional include files required depending
upon the compile product you are using. Typical compilers
include Microsoft C by Microsoft or Turbo C by Boland Int'l.
*/
#include <stdio.h>
/* define the union XYZ */
union XYZ {
int i;
char a[2];
};
main()
{
/* allocate space for variable "abc" */
union XYZ abc;
/* store an integer into i - assume 16 bit integers */
abc.i=0xfaaf;
/* print out one byte at a time */
printf("%x %x\n",abc.a[0], abc.a[1] );
}